<template>
  <div id="examineStudentList">
    <el-tabs v-model="activeName" class="tabPlane">
      <el-tab-pane label="信息审核" name='1'>
        <div class="contentClass onlyShowContent">
          <el-row :gutter='20'>
            <el-col :span='3'>
              <el-select size='small' v-model="examineStatus" placeholder="审核状态" clearable  value-key="id">
                <el-option v-for="item in examineStatusOptions" :key="item.id" :label="item.name" :value="item">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span='4'>
              <el-input size='small' v-model="searchkey" placeholder="请输入学号或姓名搜索"></el-input>
            </el-col>
            <el-col :span='3'>
              <el-button size='small' type="primary" @click="getManagerList('search')">查询</el-button>
            </el-col>
            <el-col :span='24' style="margin-top:20px;">
              <el-table :data="studentTableData">
                <el-table-column label="序号" width="50">
                  <template slot-scope="scope">
                    {{scope.$index+1}}
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="提交人" width="150">
                </el-table-column>
                <el-table-column prop="sn" label="学号" width="150">
                </el-table-column>
                <el-table-column prop="commitTime" label="提交时间">
                  <template slot-scope="scope">
                    {{scope.row.commitTime | moment("YYYY-MM-DD")}}
                  </template>
                </el-table-column>
                <el-table-column prop="instructorName" label="审核人" width="150">
                </el-table-column>
                <el-table-column prop="instructorTime" label="审核时间">
                  <template slot-scope="scope">
                    {{scope.row.instructorTime | moment("YYYY-MM-DD")}}
                  </template>
                </el-table-column>
                <el-table-column prop="instructorAudit" label="审核状态" width="100">
                  <template slot-scope="scope">
                    {{scope.row.instructorAudit | examineFilter}}
                  </template>
                </el-table-column>
                <el-table-column label="操作" width="150">
                  <template slot-scope="scope">
                    <router-link class="routerlink" :to="{name:'counsellor_examine',query:{id:scope.row.id}}">{{scope.row.instructorAudit===0? '审核':'查看'}}</router-link>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span='24' style="margin:20px auto;text-align:center;" v-if="studentTableData.length!=0">
              <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page" :page-sizes="[10, 20, 30, 40,50,100]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
              </el-pagination>
            </el-col>
          </el-row>
        </div>
      </el-tab-pane>
    </el-tabs>

  </div>
</template>
<script>
import {counsellor} from '@api/index'
export default {
  name: 'examineStudentList',
  data () {
    return {
      activeName: '1',
      examineStatus: {
        id: '',
        name: ''
      }, // 审核状态
      examineStatusOptions: [],
      searchkey: null, // 搜索
      // 学生列表信息
      studentTableData: [],
      page: 1,
      size: 10,
      total: 1
    }
  },
  created () {

  },
  mounted () {
    this.initPage()
  },
  methods: {
    initPage () {
      this.getExamineStatus()
      this.getManagerList()
    },
    // 获取审核状态
    getExamineStatus () {
      counsellor()._getExamineStatus().then(res => {
        this.examineStatusOptions.push(...res)
      })
    },
    // 获取学生列表
    getManagerList (paramsType = null) {
      if (paramsType === 'search') {
        this.page = 1
        this.size = 10
      }
      let loading = this.$loading({
        target: '.el-table__body'
      })
      counsellor()._getAuditList(
        {
          'instructorAudit': this.examineStatus.id,
          'pgCt': this.page,
          'pgSz': this.size,
          'snOrName': this.searchkey
        }
      ).then(res => {
        this.studentTableData = []
        loading.close()
        if (res.status) {
          this.studentTableData.push(...res.data.datas)
          this.total = res.data.total
        }
      })
    },
    handleSizeChange (val) {
      this.size = val
      this.page = 1
      this.getManagerList()
    },
    handleCurrentChange (val) {
      this.page = val
      this.getManagerList()
    }
  }
}
</script>
